<html>
<head><meta charset="utf-8"><title>Print default target? · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Print.20default.20target.3F.html">Print default target?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="166621800"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Print%20default%20target%3F/near/166621800" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Print.20default.20target.3F.html#166621800">(May 27 2019 at 09:26)</a>:</h4>
<p>Is there a good way to ask rustc for the default target?</p>



<a name="166621937"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Print%20default%20target%3F/near/166621937" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Print.20default.20target.3F.html#166621937">(May 27 2019 at 09:28)</a>:</h4>
<p>the best I got is</p>
<div class="codehilite"><pre><span></span>rustc --print target-spec-json -Z unstable-options | jq &#39;.[&quot;llvm-target&quot;]&#39; -r
</pre></div>



<a name="166626388"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Print%20default%20target%3F/near/166626388" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Print.20default.20target.3F.html#166626388">(May 27 2019 at 10:44)</a>:</h4>
<p>it would be interesting to me as well :)</p>



<a name="166634712"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Print%20default%20target%3F/near/166634712" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Print.20default.20target.3F.html#166634712">(May 27 2019 at 12:57)</a>:</h4>
<p>argh, and of course mac's won't have <code>jq</code>. and "grep" can't show capture groups. wow this is awful.</p>



<a name="166634777"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Print%20default%20target%3F/near/166634777" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Print.20default.20target.3F.html#166634777">(May 27 2019 at 12:58)</a>:</h4>
<div class="codehilite"><pre><span></span>rustc --print target-spec-json -Z unstable-options | grep llvm-target | cut -d &#39;&quot;&#39; -f 4
</pre></div>


<p>technology is amazing...</p>



<a name="166636408"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Print%20default%20target%3F/near/166636408" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Print.20default.20target.3F.html#166636408">(May 27 2019 at 13:18)</a>:</h4>
<p>rustc --print cfg doesn't provide the same information in a grep friendly way?</p>



<a name="166636669"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Print%20default%20target%3F/near/166636669" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Print.20default.20target.3F.html#166636669">(May 27 2019 at 13:22)</a>:</h4>
<p>no</p>



<a name="166637019"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Print%20default%20target%3F/near/166637019" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Print.20default.20target.3F.html#166637019">(May 27 2019 at 13:27)</a>:</h4>
<p>it is all split and reassembling isn't the nicest thing I guess</p>



<a name="166637221"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Print%20default%20target%3F/near/166637221" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Print.20default.20target.3F.html#166637221">(May 27 2019 at 13:29)</a>:</h4>
<p>also, is it always <code>$ARCH-$VENDOR-$OS-$ENV</code>?</p>



<a name="166643970"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Print%20default%20target%3F/near/166643970" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Print.20default.20target.3F.html#166643970">(May 27 2019 at 15:00)</a>:</h4>
<p>shoud be</p>



<a name="166769568"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Print%20default%20target%3F/near/166769568" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Print.20default.20target.3F.html#166769568">(May 28 2019 at 23:23)</a>:</h4>
<p>It is not always <code>$ARCH-$VENDOR-$OS-$ENV</code>. You can get the target triple from <code>rustc --version --verbose</code> as well.</p>



<a name="166789053"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Print%20default%20target%3F/near/166789053" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Print.20default.20target.3F.html#166789053">(May 29 2019 at 06:59)</a>:</h4>
<p>hm, interesting. that looks slightly easier to grep for.</p>



<a name="166790901"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Print%20default%20target%3F/near/166790901" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Print.20default.20target.3F.html#166790901">(May 29 2019 at 07:34)</a>:</h4>
<p>that would be</p>
<div class="codehilite"><pre><span></span>rustc --version --verbose | grep &quot;^host:&quot; | cut -d &#39; &#39; -f 2
</pre></div>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>